package com.qf.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.dao.ChoiceQuestionDao;
import com.qf.entity.TbChoiceQuestion;
import com.qf.service.ChoiceQuestionService;
import com.qf.utils.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ChoiceQuestionServiceImpl extends ServiceImpl<ChoiceQuestionDao, TbChoiceQuestion> implements ChoiceQuestionService {

    @Autowired(required = false)
    ResultMsg resultMsg;

    @Autowired(required = false)
    ChoiceQuestionDao choiceQuestionDao;
    @Override
    public ResultMsg addChoiceQuestion(TbChoiceQuestion tbChoiceQuestion) {
        int insert = choiceQuestionDao.insert(tbChoiceQuestion);
        if (insert==1)
            return resultMsg.success();
        return resultMsg.faild(300,"添加选择题失败");
    }

    @Override
    public ResultMsg selsctChoiceOne() {
        TbChoiceQuestion choiceById = choiceQuestionDao.findChoiceById();
        return resultMsg.success(choiceById);
    }
}
